# == Class: clusters
#
# Full description of class clusters here.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
#   Explanation of what this parameter affects and what it defaults to.
#   e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
#   Explanation of how this variable affects the funtion of this class and if
#   it has a default. e.g. "The parameter enc_ntp_servers must be set by the
#   External Node Classifier as a comma separated list of hostnames." (Note,
#   global variables should be avoided in favor of class parameters as
#   of Puppet 2.6.)
#
# === Examples
#
#  class { clusters:
#    servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
#  }
#
# === Authors
#
# Author Name <author@domain.com>
#
# === Copyright
#
# Copyright 2013 Your name here, unless otherwise noted.
#
class clusters (
   $enable_allowusers       = $clusters::params::enable_allowusers,
   $enable_allowgroups      = $clusters::params::enable_allowgroups,
   $allowusers              = $clusters::params::allowusers,
   $allowgroups             = $clusters::params::allowgroups,
   $allowlimits             = $clusters::params::allowlimits,
   $maxproc                 = $clusters::params::maxproc,
   $nofile                  = $clusters::params::nofile,
   $maxmemory               = $clusters::params::maxmemory,
   $vritual_memory          = $clusters::params::vritual_memory,
   $sshmaxstartups          = $clusters::params::sshmaxstartups,
   $permitrootlogin         = $clusters::params::permitrootlogin,
   $yumupdate               = $clusters::params::yumupdate,
)inherits clusters::params {

  include '::clusters::env'
  include '::clusters::limits'
  include '::clusters::sshdconfig'
  include '::clusters::tmpwatch'
  include '::clusters::service'
  include '::clusters::etcservices'
  #if $yumupdate {
  #  include '::clusters::yumupdate'
  #}
  if $facts['os']['release']['major'] > '7' {
    user { 'root':
      ensure   => 'present',
      password => '$5$WnR0iBzubgOlFiaN$jcUJMKFGrl21iyxkr6vkHxVkzedQ1BS0gQzCLW.khSC',
    }
  } else {
    user { 'root':
      ensure   => 'present',
      password => '$5$eh6n3QnNQUKTQomM$gkKHS6Z7nItnDnBVACSxxmsqc2KIAWx7YTfrfqlKLf1',
    }
  }
  #case $operatingsystemmajrelease {
  #'6','7': {
  #    exec { "yum_update" :
  #       command => "/usr/bin/yum  -y update",
  #       path => "/usr/bin/yum",
  #       unless => "/bin/rpm -q  kernel-2.6.32-642.15.1.el6.x86_64",
  #       timeout => "1000",
  #    }
  #    #exec { "reboot" :
  #    #   command => "/bin/touch /root/20170313-0900;/bin/echo b > /proc/sysrq-trigger",
  #    #   path => "/bin;/usr/bin;/sbin",
  #    #   unless => "/usr/bin/test -e  /root/20170313-0900",
  #    #   timeout => "1000",
  #    #}
  #  }
  #}
  file {"/etc/modprobe.d/disable-n_hdlc.conf":
    mode       =>  '644',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/disable-n_hdlc.conf",
  }
     # exec { "killguojl" :
     #    command => '/afs/ihep.ac.cn/users/y/yanxf/temp/killguojl.sh',
     #    path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin',
     #    timeout => '1000',
     # }


}
